<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<%@ include file="/common-app/taglibs.jsp"%>
<!DOCTYPE html>
<html>
<head>
<title>申请书编辑</title>
<script type="text/javascript" src="${res}/js/jquery/jquery.form.js"></script>
<script type="text/javascript"
	src="${res}/js/proposal/irisPrpPrepare.js"></script>
<script type="text/javascript" src="${res}/js/validate/irisvalidator.js"></script>
<script type="text/javascript" src="${res}/js/keyword/keywordtips.js"></script>
<script type="text/javascript"
	src="${res_app}/js/app/proposal/irisPrpPrepare.js"></script>

<style>
textarea {
	overflow: auto;
}
</style>

<script type="text/javascript">
$(function(){
	queryflex();
});
/**
 * 申请书提交方法
 */


var ctxpath = "${ctx}";
var prcWin = new progressWin("${res}");//初始化遮罩层
/**
 * 页面初始化方法 所有的都定义在里面
 */
$(document).ready (function() {
	$("#wbox1").click(function() {
		check("check");
		
		
	});
	
	$("#wbox2").click(function() {
		
		check("check");
		
	});
	
	initControl();
	
	$("table.t_css").not("[id='finances']").not("[id='checkbox_table_']").not("[id='budgetsMsg2']").each(function(){
		$(this).find("tr:even").addClass("li_1");
		$(this).find("tr:odd").addClass("li_2");
	});
	$("table").addClass("table01");
	$("#checkbox_table_").removeClass("table01");
	$("#feaReport_upload").removeClass("table01");
	$("#recPro_upload").removeClass("table01");
    $('div').find("[id^='checkbox_dyn_']").find("tr").removeClass("li_1").removeClass("li_2");
    $('div').find("[id^='checkbox_dyn_']").find("td").css("border",'0px solid');
	
	updatePdfNotes();
	window.setInterval("checkPdfStatus()", "10000");//检验申请书的pdf
});

$(document).ready(function() {
	fileInit("feaReport_upload","PDF");
	fileInit("recPro_upload","PDF");
	fileInit("prpContent_upload","JPG,DOC,DOCX,WPS,PDF",null,"{'JPG':'20480','DOC':'20480','DOCX':'20480','WPS':'20480','PDF':'20480'}");
	
	//fileInitAttach("attachAdd", "JPG,PDF", null, 20, "{'JPG':'3072','PDF':'3072'}");
	$("#prpContent_upload").find(".file").hide();//隐藏文本框
});


$(document).ready(function() {
	$("#org").attr("disabled","true");
	initDepartForComplete("org");
	 initControl();
});

/**
 * 申报日期默认为当前日期
 */
$(document).ready(function() {


	var nowDate = '${sercverSysDate1}';
    if($("#submit_date").val()==""){
	   $("#submit_date").val(nowDate);
    }

});

/**
 * 填写检查
 */
function check(type){
	setTotalAmt();
	validate($("#basicInfo1"),"项目基本情况");
	var subject1 = $("#subject").val();
	var subject2 = $("#subject4").val();
	var subject3 = $("#subject5").val();
	if(subject1 == ""){
		irisValaddMsg("项目基本情况-->学科分类1及代码不能为空");
	}
	if(subject1 != "" && subject2 != ""){
		if(subject1 == subject2)
			irisValaddMsg("项目基本情况-->学科分类1及代码与学科分类2及代码重复");
	}
	if(subject1 != "" && subject3 != ""){
		if(subject1 == subject3)
			irisValaddMsg("项目基本情况-->学科分类1及代码与学科分类3及代码重复");
	}
	if(subject2 != "" && subject3 != ""){
		if(subject2 == subject3)
			irisValaddMsg("项目基本情况-->学科分类2及代码与学科分类3及代码重复");
	}
	validate($("#basicInfo3"),"项目基本情况");
	if(missionsource()){
			irisValaddMsg("项目基本情况-->任务来源不能为空");
		}
	var keyword = $.trim($("#subject_headings").val());
	if(keyword != ""){
		var wordArray = keyword.split("；");
		var wordArray1 = keyword.split("；；");
		var wordArray2=	keyword.charAt(keyword.length-1);
		if(wordArray2=="；"){
			wordArray.length-=1;
		}
		if(wordArray.length < 3 || wordArray.length >7||wordArray1.length>1){
			irisValaddMsg("项目基本情况-->主题词填写格式不规范，请填写3个至7个与推荐项目技术内容密切相关的主题词，每个词语间应加“；”号");
		}/* else{
			for(var i = 0;i<wordArray.length;i++){
				if(wordArray[i].length > 6)
					irisValaddMsg("项目基本情况-->主题词中第"+[i+1]+"个主题词超过6个字符，请修改");
			}
		} */
	}
	validate($("#basicInfo5"),"项目基本情况");
	validate($("#proIntro"),"项目简介");
	validate($("#proBack"),"项目详细内容");
	
	var downLoadFile = $("#content_downLoadFile").text();
	if(downLoadFile==""){
		irisValaddMsg("项目详细内容-->详细科学研究内容必须上传，请确定");
	}
	
	//validate($("#feaReport_upload"),"项目详细内容-->详细科学研究内容");
	validate($("#mainPoint"),"项目详细内容");
	validate($("#othersRef"),"项目详细内容");
	validateByTabRow($("#tblAwardInfo"),"本项目曾获科技奖励情况",0);
	
	/* var recValue = $("#recommend_type_value").val();
	if(recValue = "01"){
		validate($("#recOrg"),"推荐单位意见");
	}
	if(recValue = "02"){
		validate($("#recPro"),"专家推荐意见");
	} */
	validateByTabRow($("#persons"),"候选人情况表-->候选人情况",1);
	validateByTabRow($("#tblPaperinfo"),"主要论文、专著目录-->代表性论文、专著目录",1);
	validateByTabRow($("#tblPaperinfo1"),"主要论文、专著目录-->上述代表性论文、专著被他人引用、评价的情况目录",1);
	validate($("#paperCon"),"主要论文、专著内容摘要");
	
	var recommend_type = $("#recommend_type_value").val();
	var value = $("#recPro_upload").find("input[id='file_code']").val();
	if( value=="" && recommend_type == '02'){
		irisValaddMsg("专家推荐意见-->专家推荐意见必须上传，请确定 ");
	}
	validateByTabRow($("#tabaccessory"),"附件清单-->代表性论文、专著",1);
	validateByTabRow($("#tabaccessory1"),"附件清单-->上述代表性论文、专著被他人引用情况",1);
	validateByTabRow($("#tabaccessory2"),"附件清单-->检索报告",1);
	validateByTabRow($("#tabaccessory3"),"附件清单-->其它证明材料",0);
	var indexAll=addnum();
	if(parseInt(indexAll)>30){
				irisValaddMsg("附件清单-->代表性论文、专著，上述代表性论文、专著被他人引用情况，检索报告，其它证明材料总数和不能超过30条");
	}
    <security:authorize ifNotGranted="A_DAILU_PROPOSAL">irisFundEmpty($("#finances"),"单位财务信息不完整，请联系单位管理员完善单位信息");</security:authorize><security:authorize ifAnyGranted="A_DAILU_PROPOSAL">irisFundEmpty($("#finances"),"请完善单位信息");</security:authorize>prp_attach();
	if(!valResult()){
		irisValShowMsg($("#wbox1"));
		return false;
	}
	if(type=="check"){
		showBox($("#wbox1"), "300px", "200px", "检查通过","1:所有检查全部合格");
	}
	return true;
}



function setTotalAmt(){
	$('#total_amt').val($("#input_total").val());
	$('#request_amt').val($("#source_apply").val());
}

</script>
<style>
textarea {
	overflow: auto;
}
</style>
</head>
<body>

	<c:set var="xmlstr" value="${xmlData}" scope="request" />
	<x:parse xml="${xmlstr}" var="xmlData" scope="request" />
	<input type="hidden" id="childDiv" class="thickbox" />
	<input type="hidden" id="filePath" value="${ctx}/file/ajax-filedownload?fileCode="/>
	<input type="hidden" id="menuId" value="${param.menuId}" />
	<input type="hidden" id="sysDate" value="${sercverSysDate}" />

	<div id="showMessage"></div>
	<div id="content">

		<cpt:helpTips key="prpedit" id="prpEditTips"></cpt:helpTips>
		<div class="clear_h15"></div>
		<div class="word_box" id="mainDiv">
			<div class="bar_btn">
				<span class="left"> <c:set var="grantCode">
						<x:out select="$xmlData/data/proposal/grant_code" />
					</c:set> <c:set var="flag_shizhi">
						<x:out select="$xmlData/data/proposal/flag_shizhi" />
					</c:set> <input name="Submit" type="button" class="button_01" value="保存"
					onclick="saveAction()" /> &nbsp; <c:if
						test="${not empty fbl.pdfViewUrl}">
						<input name="Submit" type="button" class="button_01" value="下载PDF"
							onclick="genPdfAction()" />
					</c:if> <security:authorize ifNotGranted="A_DAILU_PROPOSAL">
					&nbsp; <input name="Submit" type="button" class="button_01"
							value="提交给单位管理员" onclick="submitAction()" />
					</security:authorize> <security:authorize ifAnyGranted="A_DAILU_PROPOSAL">
					&nbsp; <input name="Submit" type="button" class="button_01"
							value="提交到归口管理部门" onclick="submitAction()" />
					</security:authorize> &nbsp; <input name="Submit" type="button" class="button_01"
					value="返回" onclick="backToList()" />
				</span> <span class="right"> <input title="填写检查" class="btn_inspect"
					type="button" id="wbox1" />
				</span> 
				<span class="right">
				<c:set var="template">安徽省自然科学奖填写说明.doc</c:set>
				<input name="Submit" type="button" class="button_01" value="填写说明" onclick="return ContentDownDesc('${template}');" />&nbsp;&nbsp;
				</span>
				<c:set var="sub_grant_code">
					<x:out select="$xmlData/data/proposal/sub_grant_code" />
				</c:set>

			</div>
			<div class="bar_b">
				<input type="hidden" id="pdfStatus" value="${pdfStatus}" /> <span
					class="right">版本号：<span name="proposal/prp_version"
					id="prp_version"><x:out
							select="$xmlData/data/proposal/prp_version" /></span></span>
			</div>
			<form method="post" id="mainForm">
				<input type="hidden" value="${grantCode}" id="grantCode"
					name="grantCode"> <input type="hidden" value="${posCode}"
					id="posCode" name="posCode"> <input type="hidden"
					value="<iris:des3 code="${posCode}"></iris:des3>" id="posCodeDes"
					name="posCodeDes"> <input type="hidden"
					value="<iris:des3 code="${fbl.pdfCode}"></iris:des3>"
					id="pdfCodeDes" name="pdfCodeDes"> <input type="hidden"
					value="${xmlData}" id="xmlData" name="xmlData"> <input
					type="hidden" value="${fbl.pdfCode}" id="pdfCode" name="pdfCode">
				<input type="hidden" value="${flag_shizhi}" id="flag_shizhi"
					name="proposal/flag_shizhi">
			</form>
			<div class="word_title">
				<c:set var="statYear">${statYear}</c:set>
				<c:if test="${empty statYear}">
					<c:set var="statYear">
						<x:out select="$xmlData/data/proposal/stat_year" />
					</c:set>
				</c:if>
				<input type="hidden" name="proposal/stat_year" value="${statYear}">
				<span name="proposal/grant_name"><x:out
						select="$xmlData/data/proposal/grant_name" /></span>-推荐书 (<span
					name="proposal/stat_year">${year} </span>年)<br />
				<c:set var="grantCode">
					<x:out select="$xmlData/data/proposal/grant_code" />
				</c:set>
				<%-- (<x:out select="$xmlData/data/proposal/sub_grant_name" />) --%>

				<input type="hidden" name="proposal/manage_category"
					value="<x:out select="$xmlData/data/proposal/manage_category" />" />
				<input type="hidden" name="proposal/sub_grant_name"
					value="<x:out select="$xmlData/data/proposal/sub_grant_name" />" />
				<input type="hidden" name="proposal/grant_code"
					value="<x:out select="$xmlData/data/proposal/grant_code" />" /> <input
					type="hidden" name="proposal/psn_code"
					value="<x:out select="$xmlData/data/proposal/psn_code" />" /> <input
					type="hidden" id="grant_no" name="proposal/grant_no"
					value="<x:out select="$xmlData/data/proposal/grant_no" />" /> <input
					type="hidden" name="proposal/sub_grant_code"
					value="<x:out select="$xmlData/data/proposal/sub_grant_code" />" />
				<input name="proposal/register_area_code" type="hidden"
					value="<x:out select="$xmlData/data/organizations/organization[@submit_org='1']/area_value" />" />
				<input name="proposal/register_area_name" type="hidden"
					value="<x:out select="$xmlData/data/organizations/organization[@submit_org='1']/area_name" />" />
				<input type="hidden" id="sub_grant_no" name="proposal/sub_grant_no"
					value="<x:out select="$xmlData/data/proposal/sub_grant_no" />" />
				<input type="hidden" name="proposal/help_grant_code"
					value="<x:out select="$xmlData/data/proposal/help_grant_code" />" />
				<input type="hidden" id="help_grant_no"
					name="proposal/help_grant_no"
					value="<x:out select="$xmlData/data/proposal/help_grant_no" />" />
				<c:set var="formCode">
					<x:out select="$xmlData/data/proposal/form_code" />
				</c:set>
				<c:set var="nature_value">
					<x:out
						select="$xmlData/data/organizations/organization[@submit_org='1']/nature_value" />
				</c:set>
				<c:if test="${empty formCode}">
					<c:set var="formCode" value="${param.formCode}"></c:set>
				</c:if>
				<input type="hidden" name="proposal/form_code" value="${formCode}" />
				<input type="hidden" name="proposal/request_amt" id="request_amt"
					value="<x:out select="$xmlData/data/proposal/request_amt"/>">
				<input type="hidden" name="proposal/year" value="${year}" /> <input
					type="hidden" name="proposal/org_type_name" id="org_type_name"
					value="" /> <input type="hidden" name="proposal/submit_date"
					id="submit_date" value="" />

				<c:set var="org_type_name">
					<x:out select="$xmlData/data/proposal/org_type_name" />
				</c:set>
				<!-- 公用的配置界面 -->
				<jsp:include page="./prpeditmain_public.jsp"><jsp:param
						value="${xmlstr}" name="xmlstr" /></jsp:include>
			</div>
			<div id="tabnav">
				<ul>
					<li class="down" id="tab1" onclick="changeTab(this.id)"><a
						href="###"><span>项目基本情况</span></a></li>

					<li id="tab2" onclick="changeTab(this.id)"><a href="###"><span>项目简介</span></a>
					</li>

					<li id="tab3" onclick="changeTab(this.id)"><a href="###"><span>项目详细内容</span></a>
					</li>
					<li id="tab4" onclick="changeTab(this.id)"><a href="###"><span>本项目曾获科技奖励情况</span></a>
					<!-- </li>
					<li id="tab5" onclick="changeTab(this.id)"><a href="###"><span>推荐单位意见</span></a>
					</li> -->
					<li id="tab6" onclick="changeTab(this.id)"><a href="###"><span>候选人情况</span></a>
					</li>
					<li id="tab7" onclick="changeTab(this.id)"><a href="###"><span>主要论文、专著目录</span></a>
					</li>
					<li id="tab8" onclick="changeTab(this.id)"><a href="###"><span>主要论文、专著内容摘要</span></a>
					</li>
				</ul>
			</div>
			<div id="tabnav">
				<ul>
					
					<li id="tab10" onclick="changeTab(this.id)"><a href="###"><span>专家推荐意见</span></a>
					</li>
					<li id="tab9" onclick="changeTab(this.id)"><a href="###"><span>附件清单</span></a>
					</li>
				</ul>
			</div>
			<div class="tab_box" id="fragment-tab1">
				<jsp:include page="../info/prpInfoEdit_zrkxzxq.jsp">
					<jsp:param value="${grantName}" name="grantName" />
				</jsp:include>
			</div>

			<div class="tab_box" id="fragment-tab2" style="display: none">
				<jsp:include page="../info/prpinfoedit_xxjjzxq.jsp"></jsp:include>
			</div>

			<div class="tab_box" id="fragment-tab3" style="display: none">
				<jsp:include page="../info/prpinfo_xxnrzxq.jsp"></jsp:include>
			</div>
			<div class="tab_box" id="fragment-tab4" style="display: none">
				<jsp:include page="../info/prpinfoedit_jlqkzxq.jsp"></jsp:include>
			</div>
			<%-- <div class="tab_box" id="fragment-tab5" style="display: none">
				<jsp:include page="../info/prpinfoedit_tjdwzxq.jsp"></jsp:include>
			</div> --%>

			<div class="tab_box" id="fragment-tab10" style="display: none">
				<jsp:include page="../info/prpinfoedit_tjdw2zxq.jsp"></jsp:include>
			</div>
			<div class="tab_box" id="fragment-tab6" style="display: none">
				<jsp:include
					page="../../2014/edit/content/prpContentEdit_jxkjjbjzxq.jsp">
					<jsp:param value="候选人情况（限4家）" name="title" />
					<jsp:param value="4" name="num" />
				</jsp:include>
			</div>
			<div class="tab_box" id="fragment-tab7" style="display: none">
				<jsp:include page="../info/prpinfoedit_rwzzzxq.jsp"></jsp:include>
			</div>
			<div class="tab_box" id="fragment-tab8" style="display: none">
				<jsp:include page="../info/prpinfoeedit_zyrwzxq.jsp"></jsp:include>
			</div>
			<div class="tab_box" id="fragment-tab9" style="display: none">
				<jsp:include page="../../2014/edit/attach/prpAttachEdit_by_public_2016.jsp">
					<jsp:param value="代表性论文、专著（不超过6篇）" name="title1" />
					<jsp:param value="上述代表性论文、专著被他人引用情况（不超过6篇）" name="title2" />
					<jsp:param value="检索报告" name="title3" />
					<jsp:param value="其它证明材料" name="title4" />
					<jsp:param value="6" name="number1" />
					<jsp:param value="6" name="number2" />
					<jsp:param value="28" name="number3" />
					<jsp:param value="27" name="number4" />
				</jsp:include>
			</div>

			<%-- <div class="tab_box" id="fragment-tab10" style="display: none">
					<jsp:include page="../attach/prpAttachEdit_by_common.jsp">
						<jsp:param value="${xmlstr}" name="xmlstr" />
						<jsp:param value="3.递交纸质材料时，提供系统打印的申请书纸质文件，连同以上附件材料（一式三份，A4规格，正反面打印，附有目录及页码，胶装成册），签字盖章后报送属地经信部门。" name="str1" />
						<jsp:param value="4.递交纸质材料时，区经信部门校验以上附件材料的原件。" name="str2" />
					</jsp:include>
				</div>--%>



			<div class="bar_btn02">
				<span class="left"> <input name="Submit" type="button"
					class="button_01" value="保存" onclick="saveAction()" /> &nbsp; <c:if
						test="${not empty fbl.pdfViewUrl}">
						<input name="Submit" type="button" class="button_01" value="下载PDF"
							onclick="genPdfAction()" />
					</c:if> <security:authorize ifNotGranted="A_DAILU_PROPOSAL">
					&nbsp; <input name="Submit" type="button" class="button_01"
							value="提交给单位管理员" onclick="submitAction()" />
					</security:authorize> <security:authorize ifAnyGranted="A_DAILU_PROPOSAL">
						<c:if test="${flag_shizhi  ne '1' }">
					&nbsp; <input name="Submit" type="button" class="button_01"
								value="提交到区主管部门" onclick="submitAction()" />
						</c:if>
						<c:if test="${flag_shizhi =='1' }">
					&nbsp; <input name="Submit" type="button" class="button_01"
								value="提交到市主管部门" onclick="submitAction()" />
						</c:if>
					</security:authorize> &nbsp; <input name="Submit" type="button" class="button_01"
					value="返回" onclick="backToList()" />
				</span> <span class="right"> <input title="填写检查" class="btn_inspect"
					type="button" id="wbox2" />
				</span>
				<span class="right">
			    <input name="Submit" type="button" class="button_01" value="填写说明" onclick="return ContentDownDesc('${template}');" />&nbsp;&nbsp;
				</span>
			</div>
		</div>
		<div class="clear_h15"></div>
	</div>
</body>

</html>